#ifndef _OS_INNER_H_
#define _OS_INNER_H_

int eimedia_bus_init(void);
void eimedia_bus_exit(void);

extern struct bus_type eimedia_bus_type;

#define EIMEDIA_DEVICE_MAJOR     207
#define EIMEDIA_DYNAMIC_MINOR    255

struct eimedia_device;

struct eimedia_pm_ops {
	int (*pm_prepare)(struct eimedia_device *dev);
	void (*pm_complete)(struct eimedia_device *dev);

	int (*pm_suspend)(struct eimedia_device *dev);
	int (*pm_resume)(struct eimedia_device *dev);

	int (*pm_freeze)(struct eimedia_device *dev);
	int (*pm_restore)(struct eimedia_device *dev);
};

#define MULTIMIDIA_MAX_DEV_NAME_LEN 32

struct eimedia_driver {
	struct device_driver driver;
	struct eimedia_pm_ops *pmops;
	char name[MULTIMIDIA_MAX_DEV_NAME_LEN];
};

#define to_eimedia_driver(drv) \
	container_of((drv), struct eimedia_driver, driver)

struct eimedia_device {
	struct os_list_head list;

	char devfs_name[MULTIMIDIA_MAX_DEV_NAME_LEN];

	unsigned int minor;

	struct device device;

	struct module *owner;

	const struct file_operations *fops;

	struct eimedia_pm_ops *pmops;

	struct eimedia_driver *driver;
};

#define to_eimedia_device(dev) \
	container_of((dev), struct eimedia_device, device)

int eimedia_register(struct eimedia_device *pdev);

int eimedia_deregister(struct eimedia_device *pdev);

int eimedia_device_register(struct eimedia_device *pdev);
void eimedia_device_deregister(struct eimedia_device *pdev);
struct eimedia_driver *eimedia_driver_register(const char *name,
					       struct module *owner,
					       struct eimedia_pm_ops *ops);
void eimedia_driver_deregister(struct eimedia_driver *pdrv);

#endif
